package com.tj.collection.db.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.common.utils.StringUtils;
import com.tj.collection.db.dao.ClReceiverDetailDao;
import com.tj.collection.db.entity.ClReceiverDetailEntity;
import com.tj.collection.db.entity.business.ClReceiverInfoEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2019-09-03
 * Time: 10:23
 */
@Repository
public class ClReceiverDetailDaoImpl extends AbstractBaseMapper<ClReceiverDetailEntity> implements ClReceiverDetailDao {

    @Override
    public ClReceiverDetailEntity selectOneByCollectionNo(String collectionNo) {
        if (StringUtils.isEmpty(collectionNo)) {
            return null;
        }
        Map<String, Object> map = new HashMap<>();
        map.put("collectionNo", collectionNo);
        return getSqlSession().selectOne(this.getStatement("selectOneByCollectionNo"), map);
    }

    @Override
    public List<ClReceiverDetailEntity> selectListByCollectionNos(List<String> collectionNos) {
        Map<String, Object> map = new HashMap<>();
        map.put("collectionNos", collectionNos);
        return getSqlSession().selectList(this.getStatement("selectListByCollectionNos"), map);
    }

    @Override
    public List<ClReceiverInfoEntity> selectOverdueNeedNotifyOrderBill(Map<String, Object> params) {
        return getSqlSession().selectList(this.getStatement("selectOverdueNeedNotifyOrderBill"), params);
    }

    @Override
    public List<ClReceiverDetailEntity> getClReceiverDetailEntityByMobile(String mobile) {
        Map<String, Object> map = new HashMap<>();
        map.put("mobile", mobile);
        return getSqlSession().selectList(this.getStatement("getClReceiverDetailEntityByMobile"), map);
    }
}
